.class public Lcom/nemustech/tiffany/world/TFTextures;
.super Ljava/lang/Object;
.source "TFTextures.java"


# static fields
.field private static final LOG_TEXTURE:Z = false

.field static final TAG:Ljava/lang/String; = "TFTextures"

.field private static mRect:Landroid/graphics/Rect;


# instance fields
.field private mMaxTextureIndex:I

.field private mModel:Lcom/nemustech/tiffany/world/TFModel;

.field private mTextureCount:I

.field private mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 478
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    sput-object v0, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    return-void
.end method

.method public constructor <init>(Lcom/nemustech/tiffany/world/TFModel;I)V
    .locals 1
    .parameter "model"
    .parameter "numFaces"

    .prologue
    .line 23
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 477
    const/4 v0, -0x1

    iput v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    .line 24
    iput-object p1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    .line 25
    invoke-virtual {p0, p2}, Lcom/nemustech/tiffany/world/TFTextures;->setNumFaces(I)V

    .line 26
    return-void
.end method

.method static createTextureInfo(Landroid/graphics/Bitmap;Landroid/graphics/Rect;)Lcom/nemustech/tiffany/world/TFTextureInfo;
    .locals 6
    .parameter "bmp"
    .parameter "rectSet"

    .prologue
    .line 449
    new-instance v1, Lcom/nemustech/tiffany/world/TFTextureInfo;

    invoke-direct {v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;-><init>()V

    .line 450
    .local v1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 452
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    if-nez p1, :cond_0

    .line 454
    iput-object p0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    .line 464
    :goto_0
    return-object v1

    .line 458
    :cond_0
    iget v2, p1, Landroid/graphics/Rect;->left:I

    iget v3, p1, Landroid/graphics/Rect;->top:I

    invoke-virtual {p1}, Landroid/graphics/Rect;->width()I

    move-result v4

    invoke-virtual {p1}, Landroid/graphics/Rect;->height()I

    move-result v5

    invoke-static {p0, v2, v3, v4, v5}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;

    move-result-object v2

    iput-object v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    goto :goto_0
.end method

.method private loadTexture(Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;I)V
    .locals 3
    .parameter "layer"
    .parameter "faceIndex"

    .prologue
    .line 82
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-nez v0, :cond_0

    .line 84
    iget v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resource_id:I

    const/4 v1, -0x1

    if-eq v0, v1, :cond_1

    .line 85
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resources:Landroid/content/res/Resources;

    iget v1, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resource_id:I

    invoke-static {v0, v1}, Lcom/nemustech/tiffany/world/TFUtils;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;

    move-result-object v0

    iput-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    .line 99
    :cond_0
    :goto_0
    return-void

    .line 86
    :cond_1
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->fileName:Ljava/lang/String;

    if-eqz v0, :cond_2

    .line 87
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->fileName:Ljava/lang/String;

    invoke-static {v0}, Lcom/nemustech/tiffany/world/TFUtils;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    iput-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    goto :goto_0

    .line 89
    :cond_2
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFModel;->mJitImageProvider:Lcom/nemustech/tiffany/world/TFModel$JitImageProvider;

    if-eqz v0, :cond_3

    .line 90
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFModel;->mJitImageProvider:Lcom/nemustech/tiffany/world/TFModel$JitImageProvider;

    invoke-interface {v0, p2}, Lcom/nemustech/tiffany/world/TFModel$JitImageProvider;->getImage(I)Landroid/graphics/Bitmap;

    move-result-object v0

    iput-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    goto :goto_0

    .line 91
    :cond_3
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFModel;->getParentHolder()Lcom/nemustech/tiffany/world/TFHolder;

    move-result-object v0

    if-eqz v0, :cond_4

    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFModel;->getParentHolder()Lcom/nemustech/tiffany/world/TFHolder;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFHolder;->getItemProvider()Lcom/nemustech/tiffany/world/TFItemProvider;

    move-result-object v0

    if-eqz v0, :cond_4

    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFModel;->getParentHolder()Lcom/nemustech/tiffany/world/TFHolder;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFHolder;->getItemProvider()Lcom/nemustech/tiffany/world/TFItemProvider;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFItemProvider;->getJitImageProvider()Lcom/nemustech/tiffany/world/TFItemProvider$JitImageProvider;

    move-result-object v0

    if-eqz v0, :cond_4

    .line 93
    iget-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFModel;->getParentHolder()Lcom/nemustech/tiffany/world/TFHolder;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFHolder;->getItemProvider()Lcom/nemustech/tiffany/world/TFItemProvider;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFItemProvider;->getJitImageProvider()Lcom/nemustech/tiffany/world/TFItemProvider$JitImageProvider;

    move-result-object v0

    iget-object v1, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget v1, v1, Lcom/nemustech/tiffany/world/TFModel;->mItemIndex:I

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Lcom/nemustech/tiffany/world/TFItemProvider$JitImageProvider;->getImage(II)Landroid/graphics/Bitmap;

    move-result-object v0

    iput-object v0, p1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    .line 94
    const-string v0, "TFTextures"

    const-string v1, "load texture through jit provider"

    invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 97
    :cond_4
    const-string v0, "TFTextures"

    const-string v1, "Loading texture failed due to corrupted texture info"

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method private putTextureInfo(ILcom/nemustech/tiffany/world/TFTextureInfo;)V
    .locals 8
    .parameter "index"
    .parameter "info"

    .prologue
    .line 374
    iget v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    if-le p1, v6, :cond_2

    .line 375
    iput p1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    .line 376
    iget v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    add-int/lit8 v6, v6, 0x1

    iput v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    .line 413
    :cond_0
    :goto_0
    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aput-object p2, v6, p1

    .line 414
    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    if-eqz v6, :cond_1

    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    invoke-static {}, Lcom/nemustech/tiffany/world/TFWorld;->requestRender()V

    .line 415
    :cond_1
    return-void

    .line 380
    :cond_2
    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v5, v6, p1

    .line 382
    .local v5, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    if-eqz v5, :cond_6

    .line 385
    invoke-virtual {v5}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayerCount()I

    move-result v4

    .line 386
    .local v4, layerCountOld:I
    invoke-virtual {p2}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayerCount()I

    move-result v3

    .line 388
    .local v3, layerCountNew:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_1
    if-ge v1, v4, :cond_0

    .line 390
    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v6}, Lcom/nemustech/tiffany/world/TFModel;->getImageCacheLockStatus()Z

    move-result v6

    if-nez v6, :cond_4

    const/4 v6, 0x1

    move v0, v6

    .line 393
    .local v0, bClearImageCache:Z
    :goto_2
    if-eqz v0, :cond_3

    .line 395
    const/4 v2, 0x0

    .local v2, j:I
    :goto_3
    if-ge v2, v3, :cond_3

    .line 397
    iget-object v6, p2, Lcom/nemustech/tiffany/world/TFTextureInfo;->mLayer:[Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    aget-object v6, v6, v2

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eqz v6, :cond_5

    iget-object v6, p2, Lcom/nemustech/tiffany/world/TFTextureInfo;->mLayer:[Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    aget-object v6, v6, v2

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    iget-object v7, v5, Lcom/nemustech/tiffany/world/TFTextureInfo;->mLayer:[Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    aget-object v7, v7, v1

    iget-object v7, v7, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-ne v6, v7, :cond_5

    .line 399
    const/4 v0, 0x0

    .line 404
    .end local v2           #j:I
    :cond_3
    invoke-direct {p0, v5, v0, v1}, Lcom/nemustech/tiffany/world/TFTextures;->removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;ZI)V

    .line 388
    add-int/lit8 v1, v1, 0x1

    goto :goto_1

    .line 390
    .end local v0           #bClearImageCache:Z
    :cond_4
    const/4 v6, 0x0

    move v0, v6

    goto :goto_2

    .line 395
    .restart local v0       #bClearImageCache:Z
    .restart local v2       #j:I
    :cond_5
    add-int/lit8 v2, v2, 0x1

    goto :goto_3

    .line 409
    .end local v0           #bClearImageCache:Z
    .end local v1           #i:I
    .end local v2           #j:I
    .end local v3           #layerCountNew:I
    .end local v4           #layerCountOld:I
    :cond_6
    iget v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    add-int/lit8 v6, v6, 0x1

    iput v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    goto :goto_0
.end method

.method private removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;Z)V
    .locals 2
    .parameter "texInfo"
    .parameter "clearBitmapCache"

    .prologue
    .line 34
    invoke-virtual {p1}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayerCount()I

    move-result v1

    .line 36
    .local v1, layerCount:I
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v1, :cond_0

    .line 37
    invoke-direct {p0, p1, p2, v0}, Lcom/nemustech/tiffany/world/TFTextures;->removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;ZI)V

    .line 36
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 38
    :cond_0
    return-void
.end method

.method private removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;ZI)V
    .locals 5
    .parameter "texInfo"
    .parameter "clearBitmapCache"
    .parameter "layerIndex"

    .prologue
    .line 43
    invoke-virtual {p1, p3}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 46
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    if-nez v0, :cond_0

    .line 47
    new-instance v3, Ljava/lang/IllegalArgumentException;

    const-string v4, "Invalid texture layer index"

    invoke-direct {v3, v4}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 52
    :cond_0
    iget-boolean v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    if-eqz v3, :cond_1

    iget-object v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v4, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    if-ne v3, v4, :cond_1

    .line 53
    iget v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->magicKey:I

    sget v4, Lcom/nemustech/tiffany/world/TFWorld;->mTextureMagicKey:I

    if-ne v3, v4, :cond_3

    .line 54
    iget v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->texture_name:I

    .line 55
    .local v2, texture_name:I
    new-instance v1, Lcom/nemustech/tiffany/world/TFTextures$1;

    invoke-direct {v1, p0, v2}, Lcom/nemustech/tiffany/world/TFTextures$1;-><init>(Lcom/nemustech/tiffany/world/TFTextures;I)V

    .line 63
    .local v1, textureEraser:Ljava/lang/Runnable;
    invoke-static {v1}, Lcom/nemustech/tiffany/world/TFWorld;->queueEvent(Ljava/lang/Runnable;)V

    .line 67
    .end local v1           #textureEraser:Ljava/lang/Runnable;
    .end local v2           #texture_name:I
    :goto_0
    const/4 v3, 0x0

    iput-boolean v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    .line 69
    :cond_1
    if-eqz p2, :cond_2

    iget-object v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eqz v3, :cond_2

    .line 71
    iget-object v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    invoke-virtual {v3}, Landroid/graphics/Bitmap;->recycle()V

    .line 72
    const/4 v3, 0x0

    iput-object v3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    .line 74
    :cond_2
    return-void

    .line 65
    :cond_3
    const-string v3, "TFTextures"

    const-string v4, "removeTexture was ignored since magic key didn\'t match"

    invoke-static {v3, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method static setTextureInfo(Ljavax/microedition/khronos/opengles/GL10;Lcom/nemustech/tiffany/world/TFTextureInfo;III)V
    .locals 25
    .parameter "gl"
    .parameter "texInfo"
    .parameter "textureFilter"
    .parameter "layerIndex"
    .parameter "magicKey"

    .prologue
    .line 120
    move-object/from16 v0, p1

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v14

    .line 123
    .local v14, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    iget-object v4, v14, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eqz v4, :cond_6

    .line 125
    iget-boolean v4, v14, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    if-nez v4, :cond_3

    .line 127
    const/4 v4, 0x1

    new-array v4, v4, [I

    .line 128
    .local v4, textureNameVessel:[I
    const/4 v5, 0x1

    const/4 v6, 0x0

    move-object/from16 v0, p0

    move v1, v5

    move-object v2, v4

    move v3, v6

    invoke-interface {v0, v1, v2, v3}, Ljavax/microedition/khronos/opengles/GL10;->glGenTextures(I[II)V

    .line 129
    const/4 v5, 0x0

    aget v4, v4, v5

    .end local v4           #textureNameVessel:[I
    iput v4, v14, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->texture_name:I

    .line 130
    const/4 v4, 0x1

    iput-boolean v4, v14, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    .line 131
    move/from16 v0, p4

    move-object v1, v14

    iput v0, v1, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->magicKey:I

    .line 137
    const/16 p4, 0xde1

    iget v4, v14, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->texture_name:I

    .end local p4
    move-object/from16 v0, p0

    move/from16 v1, p4

    move v2, v4

    invoke-interface {v0, v1, v2}, Ljavax/microedition/khronos/opengles/GL10;->glBindTexture(II)V

    .line 139
    move-object/from16 v0, p1

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getCoordRatioWidth(I)F

    move-result p4

    const/high16 v4, 0x3f80

    cmpl-float p4, p4, v4

    if-nez p4, :cond_0

    move-object/from16 v0, p1

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getCoordRatioHeight(I)F

    move-result p1

    .end local p1
    const/high16 p3, 0x3f80

    cmpl-float p1, p1, p3

    if-eqz p1, :cond_5

    .line 141
    .end local p3
    :cond_0
    move-object v0, v14

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    move-object/from16 p1, v0

    invoke-static/range {p1 .. p1}, Landroid/opengl/GLUtils;->getInternalFormat(Landroid/graphics/Bitmap;)I

    move-result v7

    .line 142
    .local v7, format:I
    const/4 v12, 0x0

    .line 143
    .local v12, type:I
    const/16 p1, 0x0

    .line 144
    .local p1, mustConvert:Z
    const/16 p3, 0x1

    move-object v0, v14

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result v8

    .line 145
    .local v8, width:I
    const/16 p3, 0x1

    move-object v0, v14

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getHeight(Z)I

    move-result v9

    .line 148
    .local v9, height:I
    :try_start_0
    move-object v0, v14

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    move-object/from16 p3, v0

    invoke-static/range {p3 .. p3}, Landroid/opengl/GLUtils;->getType(Landroid/graphics/Bitmap;)I
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v12

    .line 154
    :goto_0
    const p3, 0x8b96

    move v0, v7

    move/from16 v1, p3

    if-eq v0, v1, :cond_2

    const/16 p3, 0x1907

    move v0, v7

    move/from16 v1, p3

    if-ne v0, v1, :cond_1

    const/16 p3, 0x0

    move-object v0, v14

    move/from16 v1, p3

    invoke-virtual {v0, v1}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result p3

    rem-int/lit8 p3, p3, 0x2

    if-nez p3, :cond_2

    :cond_1
    if-eqz p1, :cond_4

    .line 160
    :cond_2
    move-object v0, v14

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    move-object/from16 p1, v0

    .end local p1           #mustConvert:Z
    sget-object p3, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    const/16 p4, 0x0

    move-object/from16 v0, p1

    move-object/from16 v1, p3

    move/from16 v2, p4

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Bitmap;->copy(Landroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;

    move-result-object v17

    .line 161
    .local v17, bmp:Landroid/graphics/Bitmap;
    invoke-static/range {v17 .. v17}, Landroid/opengl/GLUtils;->getInternalFormat(Landroid/graphics/Bitmap;)I

    move-result v7

    .line 162
    invoke-static/range {v17 .. v17}, Landroid/opengl/GLUtils;->getType(Landroid/graphics/Bitmap;)I

    move-result v12

    .line 163
    const-string p1, "TFTextures"

    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct/range {p3 .. p3}, Ljava/lang/StringBuilder;-><init>()V

    const-string p4, "format: "

    invoke-virtual/range {p3 .. p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object p3

    move-object/from16 v0, p3

    move v1, v7

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object p3

    const-string p4, ", type: "

    invoke-virtual/range {p3 .. p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object p3

    move-object/from16 v0, p3

    move v1, v12

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object p3

    invoke-virtual/range {p3 .. p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p3

    move-object/from16 v0, p1

    move-object/from16 v1, p3

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 164
    const/16 v5, 0xde1

    const/4 v6, 0x0

    const/4 v10, 0x0

    const/4 v13, 0x0

    move-object/from16 v4, p0

    move v11, v7

    invoke-interface/range {v4 .. v13}, Ljavax/microedition/khronos/opengles/GL10;->glTexImage2D(IIIIIIIILjava/nio/Buffer;)V

    .line 166
    const/16 v13, 0xde1

    const/4 v14, 0x0

    const/4 v15, 0x0

    const/16 v16, 0x0

    move/from16 v18, v7

    move/from16 v19, v12

    invoke-static/range {v13 .. v19}, Landroid/opengl/GLUtils;->texSubImage2D(IIIILandroid/graphics/Bitmap;II)V

    .line 168
    .end local v14           #layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    invoke-virtual/range {v17 .. v17}, Landroid/graphics/Bitmap;->recycle()V

    .line 184
    .end local v7           #format:I
    .end local v8           #width:I
    .end local v9           #height:I
    .end local v12           #type:I
    .end local v17           #bmp:Landroid/graphics/Bitmap;
    :goto_1
    const/16 p1, 0xde1

    const/16 p3, 0x2801

    move-object/from16 v0, p0

    move/from16 v1, p1

    move/from16 v2, p3

    move/from16 v3, p2

    invoke-interface {v0, v1, v2, v3}, Ljavax/microedition/khronos/opengles/GL10;->glTexParameterx(III)V

    .line 185
    const/16 p1, 0xde1

    const/16 p3, 0x2800

    move-object/from16 v0, p0

    move/from16 v1, p1

    move/from16 v2, p3

    move/from16 v3, p2

    invoke-interface {v0, v1, v2, v3}, Ljavax/microedition/khronos/opengles/GL10;->glTexParameterx(III)V

    .line 186
    const/16 p1, 0xde1

    const/16 p2, 0x2802

    const p3, 0x812f

    invoke-interface/range {p0 .. p3}, Ljavax/microedition/khronos/opengles/GL10;->glTexParameterx(III)V

    .line 187
    .end local p2
    const/16 p1, 0xde1

    const/16 p2, 0x2803

    const p3, 0x812f

    invoke-interface/range {p0 .. p3}, Ljavax/microedition/khronos/opengles/GL10;->glTexParameterx(III)V

    .line 192
    return-void

    .line 134
    .restart local v14       #layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    .local p1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    .restart local p2
    .restart local p3
    .restart local p4
    :cond_3
    new-instance p0, Ljava/lang/IllegalArgumentException;

    .end local p0
    const-string p1, "setTextureInfo with already texturized info"

    .end local p1           #texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    invoke-direct/range {p0 .. p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p0

    .line 149
    .end local p3
    .end local p4
    .restart local v7       #format:I
    .restart local v8       #width:I
    .restart local v9       #height:I
    .restart local v12       #type:I
    .restart local p0
    .local p1, mustConvert:Z
    :catch_0
    move-exception p1

    .line 150
    .local p1, e:Ljava/lang/IllegalArgumentException;
    const/16 p1, 0x1

    .local p1, mustConvert:Z
    goto/16 :goto_0

    .line 173
    :cond_4
    const/16 v5, 0xde1

    const/4 v6, 0x0

    const/4 v10, 0x0

    const/4 v13, 0x0

    move-object/from16 v4, p0

    move v11, v7

    invoke-interface/range {v4 .. v13}, Ljavax/microedition/khronos/opengles/GL10;->glTexImage2D(IIIIIIIILjava/nio/Buffer;)V

    .line 175
    const/16 v18, 0xde1

    const/16 v19, 0x0

    const/16 v20, 0x0

    const/16 v21, 0x0

    move-object v0, v14

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    move-object/from16 v22, v0

    move/from16 v23, v7

    move/from16 v24, v12

    invoke-static/range {v18 .. v24}, Landroid/opengl/GLUtils;->texSubImage2D(IIIILandroid/graphics/Bitmap;II)V

    goto :goto_1

    .line 181
    .end local v7           #format:I
    .end local v8           #width:I
    .end local v9           #height:I
    .end local v12           #type:I
    .end local p1           #mustConvert:Z
    :cond_5
    const/16 p1, 0xde1

    const/16 p3, 0x0

    move-object v0, v14

    iget-object v0, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    move-object/from16 p4, v0

    const/4 v4, 0x0

    move/from16 v0, p1

    move/from16 v1, p3

    move-object/from16 v2, p4

    move v3, v4

    invoke-static {v0, v1, v2, v3}, Landroid/opengl/GLUtils;->texImage2D(IILandroid/graphics/Bitmap;I)V

    goto :goto_1

    .line 190
    .local p1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    .restart local p3
    .restart local p4
    :cond_6
    new-instance p0, Ljava/lang/IllegalArgumentException;

    .end local p0
    const-string p1, "setTextureInfo with null bmp"

    .end local p1           #texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    invoke-direct/range {p0 .. p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method private showLoadingIcon(Ljavax/microedition/khronos/opengles/GL10;I)V
    .locals 5
    .parameter "gl"
    .parameter "index"

    .prologue
    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 197
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v1, v1, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    if-nez v1, :cond_1

    .line 210
    :cond_0
    :goto_0
    return-void

    .line 199
    :cond_1
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v1, v1, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    iget-object v1, v1, Lcom/nemustech/tiffany/world/TFWorld;->mDefaultDelayImageTextureInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;

    invoke-virtual {v1, v3}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 201
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    sget-object v1, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    sget-object v2, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    iput v3, v2, Landroid/graphics/Rect;->top:I

    iput v3, v1, Landroid/graphics/Rect;->left:I

    .line 202
    sget-object v1, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v0, v3}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result v2

    iput v2, v1, Landroid/graphics/Rect;->right:I

    .line 203
    sget-object v1, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v0, v3}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getHeight(Z)I

    move-result v2

    iput v2, v1, Landroid/graphics/Rect;->bottom:I

    .line 205
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    sget-object v2, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v0, v4}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result v3

    invoke-virtual {v0, v4}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getHeight(Z)I

    move-result v4

    invoke-virtual {v1, v2, p2, v3, v4}, Lcom/nemustech/tiffany/world/TFModel;->adjustTextureCoordination(Landroid/graphics/Rect;III)V

    .line 209
    const/16 v1, 0xde1

    iget v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->texture_name:I

    invoke-interface {p1, v1, v2}, Ljavax/microedition/khronos/opengles/GL10;->glBindTexture(II)V

    goto :goto_0
.end method


# virtual methods
.method deleteImageResource(I)V
    .locals 5
    .parameter "index"

    .prologue
    const/4 v4, 0x1

    .line 350
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v1, v2, p1

    .line 353
    .local v1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    if-eqz v1, :cond_1

    .line 355
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v2}, Lcom/nemustech/tiffany/world/TFModel;->getImageCacheLockStatus()Z

    move-result v2

    if-nez v2, :cond_2

    move v2, v4

    :goto_0
    invoke-direct {p0, v1, v2}, Lcom/nemustech/tiffany/world/TFTextures;->removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;Z)V

    .line 356
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    const/4 v3, 0x0

    aput-object v3, v2, p1

    .line 357
    iget v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    sub-int/2addr v2, v4

    iput v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    .line 359
    iget v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    if-ne p1, v2, :cond_1

    .line 362
    iget v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    sub-int v0, v2, v4

    .local v0, i:I
    :goto_1
    if-ltz v0, :cond_0

    .line 363
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v2, v2, v0

    if-eqz v2, :cond_3

    .line 365
    :cond_0
    iput v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    .line 368
    .end local v0           #i:I
    :cond_1
    return-void

    .line 355
    :cond_2
    const/4 v2, 0x0

    goto :goto_0

    .line 362
    .restart local v0       #i:I
    :cond_3
    add-int/lit8 v0, v0, -0x1

    goto :goto_1
.end method

.method deleteTextureResource(I)V
    .locals 2
    .parameter "index"

    .prologue
    .line 340
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v0, v1, p1

    .line 341
    .local v0, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    if-eqz v0, :cond_0

    .line 343
    const/4 v1, 0x0

    invoke-direct {p0, v0, v1}, Lcom/nemustech/tiffany/world/TFTextures;->removeTexture(Lcom/nemustech/tiffany/world/TFTextureInfo;Z)V

    .line 344
    const/4 v1, 0x1

    iput-boolean v1, v0, Lcom/nemustech/tiffany/world/TFTextureInfo;->bTextureRemovedByForce:Z

    .line 346
    :cond_0
    return-void
.end method

.method genTexture(Ljavax/microedition/khronos/opengles/GL10;)V
    .locals 6
    .parameter "gl"

    .prologue
    .line 104
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    array-length v3, v5

    .line 106
    .local v3, size:I
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v3, :cond_2

    .line 108
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v4, v5, v0

    .line 109
    .local v4, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    if-nez v4, :cond_1

    .line 106
    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 111
    :cond_1
    invoke-virtual {v4}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayerCount()I

    move-result v2

    .line 112
    .local v2, layerCount:I
    const/4 v1, 0x0

    .local v1, j:I
    :goto_1
    if-ge v1, v2, :cond_0

    .line 113
    invoke-virtual {p0, p1, v0, v1}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;II)V

    .line 112
    add-int/lit8 v1, v1, 0x1

    goto :goto_1

    .line 116
    .end local v1           #j:I
    .end local v2           #layerCount:I
    .end local v4           #texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    :cond_2
    return-void
.end method

.method getMaxTextureIndex()I
    .locals 1

    .prologue
    .line 77
    iget v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mMaxTextureIndex:I

    return v0
.end method

.method getTextureCount()I
    .locals 1

    .prologue
    .line 325
    iget v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureCount:I

    return v0
.end method

.method getTextureInfo(I)Lcom/nemustech/tiffany/world/TFTextureInfo;
    .locals 1
    .parameter "index"

    .prologue
    .line 329
    iget-object v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v0, v0, p1

    return-object v0
.end method

.method setImageResource(ILandroid/content/res/Resources;I)V
    .locals 3
    .parameter "index"
    .parameter "resources"
    .parameter "resource_id"

    .prologue
    .line 428
    new-instance v1, Lcom/nemustech/tiffany/world/TFTextureInfo;

    invoke-direct {v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;-><init>()V

    .line 429
    .local v1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 430
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    iput p3, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resource_id:I

    .line 431
    iput-object p2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resources:Landroid/content/res/Resources;

    .line 432
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iput-object v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    .line 433
    invoke-direct {p0, p1, v1}, Lcom/nemustech/tiffany/world/TFTextures;->putTextureInfo(ILcom/nemustech/tiffany/world/TFTextureInfo;)V

    .line 434
    return-void
.end method

.method setImageResource(ILjava/lang/String;)V
    .locals 3
    .parameter "index"
    .parameter "fileName"

    .prologue
    .line 419
    new-instance v1, Lcom/nemustech/tiffany/world/TFTextureInfo;

    invoke-direct {v1}, Lcom/nemustech/tiffany/world/TFTextureInfo;-><init>()V

    .line 420
    .local v1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 421
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    iput-object p2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->fileName:Ljava/lang/String;

    .line 422
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iput-object v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    .line 423
    invoke-direct {p0, p1, v1}, Lcom/nemustech/tiffany/world/TFTextures;->putTextureInfo(ILcom/nemustech/tiffany/world/TFTextureInfo;)V

    .line 424
    return-void
.end method

.method setImageResource(ILandroid/graphics/Bitmap;Landroid/graphics/Rect;)Z
    .locals 4
    .parameter "index"
    .parameter "bmp"
    .parameter "rectSet"

    .prologue
    const/4 v3, 0x0

    .line 438
    invoke-static {p2, p3}, Lcom/nemustech/tiffany/world/TFTextures;->createTextureInfo(Landroid/graphics/Bitmap;Landroid/graphics/Rect;)Lcom/nemustech/tiffany/world/TFTextureInfo;

    move-result-object v1

    .line 439
    .local v1, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    invoke-virtual {v1, v3}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v0

    .line 440
    .local v0, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iput-object v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    .line 441
    invoke-direct {p0, p1, v1}, Lcom/nemustech/tiffany/world/TFTextures;->putTextureInfo(ILcom/nemustech/tiffany/world/TFTextureInfo;)V

    .line 443
    iget-object v2, v0, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eq v2, p2, :cond_0

    const/4 v2, 0x1

    :goto_0
    return v2

    :cond_0
    move v2, v3

    goto :goto_0
.end method

.method setNumFaces(I)V
    .locals 1
    .parameter "numFaces"

    .prologue
    .line 29
    new-array v0, p1, [Lcom/nemustech/tiffany/world/TFTextureInfo;

    iput-object v0, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    .line 30
    return-void
.end method

.method setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;I)V
    .locals 1
    .parameter "gl"
    .parameter "index"

    .prologue
    .line 321
    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, v0}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;II)V

    .line 322
    return-void
.end method

.method setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;II)V
    .locals 9
    .parameter "gl"
    .parameter "index"
    .parameter "layerIndex"

    .prologue
    const/4 v8, 0x1

    const/4 v7, 0x0

    .line 215
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v3, v5, p2

    .line 217
    .local v3, texInfo:Lcom/nemustech/tiffany/world/TFTextureInfo;
    if-eqz v3, :cond_c

    .line 219
    invoke-virtual {v3, p3}, Lcom/nemustech/tiffany/world/TFTextureInfo;->getLayer(I)Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;

    move-result-object v2

    .line 221
    .local v2, layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    iget-boolean v5, v3, Lcom/nemustech/tiffany/world/TFTextureInfo;->bTextureRemovedByForce:Z

    if-eqz v5, :cond_2

    .line 222
    iget v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->magicKey:I

    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    sget v6, Lcom/nemustech/tiffany/world/TFWorld;->mTextureMagicKey:I

    if-ne v5, v6, :cond_1

    .line 316
    .end local v2           #layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    :cond_0
    :goto_0
    return-void

    .line 225
    .restart local v2       #layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    :cond_1
    iput-boolean v7, v3, Lcom/nemustech/tiffany/world/TFTextureInfo;->bTextureRemovedByForce:Z

    .line 228
    :cond_2
    iget-boolean v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    if-eqz v5, :cond_4

    .line 230
    iget v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->magicKey:I

    iget-object v6, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v6, v6, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    sget v6, Lcom/nemustech/tiffany/world/TFWorld;->mTextureMagicKey:I

    if-ne v5, v6, :cond_3

    .line 231
    const/16 v5, 0xde1

    iget v6, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->texture_name:I

    invoke-interface {p1, v5, v6}, Ljavax/microedition/khronos/opengles/GL10;->glBindTexture(II)V

    goto :goto_0

    .line 234
    :cond_3
    iput-boolean v7, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bTexturized:Z

    .line 235
    invoke-direct {p0, v2, p2}, Lcom/nemustech/tiffany/world/TFTextures;->loadTexture(Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;I)V

    .line 236
    invoke-virtual {p0, p1, p2, p3}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;II)V

    goto :goto_0

    .line 242
    :cond_4
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eqz v5, :cond_a

    .line 245
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mTextureFilter:[I

    if-eqz v5, :cond_8

    .line 246
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mTextureFilter:[I

    aget v4, v5, v7

    .line 250
    .local v4, textureFilter:I
    :goto_1
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v5}, Lcom/nemustech/tiffany/world/TFModel;->getParentHolder()Lcom/nemustech/tiffany/world/TFHolder;

    move-result-object v0

    .line 251
    .local v0, holder:Lcom/nemustech/tiffany/world/TFHolder;
    const/4 v1, 0x0

    .line 253
    .local v1, itemProvider:Lcom/nemustech/tiffany/world/TFItemProvider;
    if-eqz v0, :cond_5

    .line 254
    invoke-virtual {v0}, Lcom/nemustech/tiffany/world/TFHolder;->getItemProvider()Lcom/nemustech/tiffany/world/TFItemProvider;

    move-result-object v1

    .line 256
    :cond_5
    iget-boolean v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bCalcCoord:Z

    if-nez v5, :cond_9

    .line 257
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mJitImageProvider:Lcom/nemustech/tiffany/world/TFModel$JitImageProvider;

    if-nez v5, :cond_6

    if-eqz v1, :cond_6

    invoke-virtual {v1}, Lcom/nemustech/tiffany/world/TFItemProvider;->getJitImageProvider()Lcom/nemustech/tiffany/world/TFItemProvider$JitImageProvider;

    move-result-object v5

    if-nez v5, :cond_6

    .line 259
    iput-boolean v8, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bCalcCoord:Z

    .line 261
    :cond_6
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    invoke-virtual {v5}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v5

    invoke-virtual {v2, v5}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->setWidth(I)V

    .line 262
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    invoke-virtual {v5}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v5

    invoke-virtual {v2, v5}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->setHeight(I)V

    .line 264
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    sget v5, Lcom/nemustech/tiffany/world/TFWorld;->mTextureMagicKey:I

    invoke-static {p1, v3, v4, p3, v5}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureInfo(Ljavax/microedition/khronos/opengles/GL10;Lcom/nemustech/tiffany/world/TFTextureInfo;III)V

    .line 266
    sget-object v5, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    sget-object v6, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    iput v7, v6, Landroid/graphics/Rect;->top:I

    iput v7, v5, Landroid/graphics/Rect;->left:I

    .line 267
    sget-object v5, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v2, v7}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result v6

    iput v6, v5, Landroid/graphics/Rect;->right:I

    .line 268
    sget-object v5, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v2, v7}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getHeight(Z)I

    move-result v6

    iput v6, v5, Landroid/graphics/Rect;->bottom:I

    .line 270
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    sget-object v6, Lcom/nemustech/tiffany/world/TFTextures;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v2, v8}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getWidth(Z)I

    move-result v7

    invoke-virtual {v2, v8}, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->getHeight(Z)I

    move-result v8

    invoke-virtual {v5, v6, p2, v7, v8}, Lcom/nemustech/tiffany/world/TFModel;->adjustTextureCoordination(Landroid/graphics/Rect;III)V

    .line 283
    :goto_2
    iget v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->resource_id:I

    const/4 v6, -0x1

    if-ne v5, v6, :cond_7

    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->fileName:Ljava/lang/String;

    if-nez v5, :cond_7

    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->owner:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mJitImageProvider:Lcom/nemustech/tiffany/world/TFModel$JitImageProvider;

    if-nez v5, :cond_7

    if-eqz v1, :cond_0

    invoke-virtual {v1}, Lcom/nemustech/tiffany/world/TFItemProvider;->getJitImageProvider()Lcom/nemustech/tiffany/world/TFItemProvider$JitImageProvider;

    move-result-object v5

    if-eqz v5, :cond_0

    .line 288
    :cond_7
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-eqz v5, :cond_0

    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v5}, Lcom/nemustech/tiffany/world/TFModel;->getImageCacheLockStatus()Z

    move-result v5

    if-nez v5, :cond_0

    .line 290
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    invoke-virtual {v5}, Landroid/graphics/Bitmap;->recycle()V

    .line 291
    const/4 v5, 0x0

    iput-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    goto/16 :goto_0

    .line 248
    .end local v0           #holder:Lcom/nemustech/tiffany/world/TFHolder;
    .end local v1           #itemProvider:Lcom/nemustech/tiffany/world/TFItemProvider;
    .end local v4           #textureFilter:I
    :cond_8
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    iget v4, v5, Lcom/nemustech/tiffany/world/TFWorld;->mTextureFilter:I

    .restart local v4       #textureFilter:I
    goto/16 :goto_1

    .line 276
    .restart local v0       #holder:Lcom/nemustech/tiffany/world/TFHolder;
    .restart local v1       #itemProvider:Lcom/nemustech/tiffany/world/TFItemProvider;
    :cond_9
    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    sget v5, Lcom/nemustech/tiffany/world/TFWorld;->mTextureMagicKey:I

    invoke-static {p1, v3, v4, p3, v5}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureInfo(Ljavax/microedition/khronos/opengles/GL10;Lcom/nemustech/tiffany/world/TFTextureInfo;III)V

    goto :goto_2

    .line 297
    .end local v0           #holder:Lcom/nemustech/tiffany/world/TFHolder;
    .end local v1           #itemProvider:Lcom/nemustech/tiffany/world/TFItemProvider;
    .end local v4           #textureFilter:I
    :cond_a
    invoke-direct {p0, v2, p2}, Lcom/nemustech/tiffany/world/TFTextures;->loadTexture(Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;I)V

    .line 298
    iget-object v5, v2, Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;->bmp:Landroid/graphics/Bitmap;

    if-nez v5, :cond_b

    .line 299
    const-string v5, "TFTextures"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Load texture fail on "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    iget-object v7, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " description:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    iget-object v7, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v7, v7, Lcom/nemustech/tiffany/world/TFModel;->mDescription:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto/16 :goto_0

    .line 301
    :cond_b
    invoke-virtual {p0, p1, p2, p3}, Lcom/nemustech/tiffany/world/TFTextures;->setTextureByIndex(Ljavax/microedition/khronos/opengles/GL10;II)V

    goto/16 :goto_0

    .line 313
    .end local v2           #layer:Lcom/nemustech/tiffany/world/TFTextureInfo$TFTextureLayer;
    :cond_c
    if-nez p3, :cond_d

    iget-object v5, p0, Lcom/nemustech/tiffany/world/TFTextures;->mModel:Lcom/nemustech/tiffany/world/TFModel;

    iget-object v5, v5, Lcom/nemustech/tiffany/world/TFModel;->mWorld:Lcom/nemustech/tiffany/world/TFWorld;

    iget-boolean v5, v5, Lcom/nemustech/tiffany/world/TFWorld;->mDefaultDelayImageDisplayMode:Z

    if-eqz v5, :cond_d

    invoke-direct {p0, p1, p2}, Lcom/nemustech/tiffany/world/TFTextures;->showLoadingIcon(Ljavax/microedition/khronos/opengles/GL10;I)V

    .line 314
    :cond_d
    const-string v5, "TFTextures"

    const-string v6, "setTextureByIndex with null texInfo"

    invoke-static {v5, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto/16 :goto_0
.end method

.method public swapFaces()V
    .locals 5

    .prologue
    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 471
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v0, v1, v3

    .line 472
    .local v0, tmp:Lcom/nemustech/tiffany/world/TFTextureInfo;
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    iget-object v2, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aget-object v2, v2, v4

    aput-object v2, v1, v3

    .line 473
    iget-object v1, p0, Lcom/nemustech/tiffany/world/TFTextures;->mTextureInfoArray:[Lcom/nemustech/tiffany/world/TFTextureInfo;

    aput-object v0, v1, v4

    .line 474
    return-void
.end method
